1. Field of the Invention
The present invention relates to a focus state detection device that can be used in a camera or video equipment or the like.
2. Description of Related Art
One method of focus state detection in a camera is the phase-difference detection method, which will be described with reference to FIG. 14. Light rays that are incident on a region 101 of a shooting lens 100 pass through a field mask 200, a field lens 300, an aperture stop 401 and a re-imaging lens 501 and are composed into an image on an image sensor array A, in which a plurality of photoelectric conversion elements are lined up in a linear manner. Similarly, light rays that are incident on a region 102 of shooting lens 100 pass through field mask 200, field lens 300, an aperture stop 402 and a re-imaging lens 502, and are composed into an image on an image sensor array B. From each image sensor array A and B is output a string of signals in accordance with the intensity distribution of the incident light.
The subject images composed on image sensor arrays A and B become relatively farther apart when shooting lens 100 is in a so-called front focus state with a clear image of the subject being composed in front of the predetermined focus plane; and conversely, the images become relatively closer together when the shooting lens is in a so-called rear focus state with a clear image of the subject being composed behind the predetermined focus plane. When the shooting lens is in focus with a clear composed subject, that is, when the shooting lens is exactly at the predetermined focus plane, the subject images on image sensor arrays A and B relatively coincide. Accordingly, it is possible to know the focus adjustment state of the shooting lens and to know the amount and direction by which the shooting lens is separated from an in-focus state (hereafter called the defocus amount) by photoelectrically converting the pair of subject images on image sensor arrays A and B into electrical signals, performing algorithm processes on the electric signals, and determining the relative position shift amount of the pair of subject images.
In addition, the projected images from re-imaging lenses 501 and 502 of image sensor arrays A and B are such that said images overlap near the predetermined focus plane, and the overlapping region is generally the dotted line region in the center of the photo field shown in FIG. 13, this region being called the focus state detection area.
Next, the algorithm process method used in determining the defocus amount will be described.
Image sensor arrays A and B are each composed of a plurality of photoelectric conversion elements, and each output a plurality of output signal strings a[1], . . . , a[n], b[1], . . . , b[n](see FIGS. 15(a) and 15(b)). The correlation algorithm is conducted while causing data in a predetermined range within this pair of signal strings to relatively shift by predetermined data number L, and correlation amount C[L] is found. Calling 1 max the maximum shift number, the range of L is -1 max to 1 max. Specifically, correlation amount C[L] can be computed from formula 1. ##EQU1##
The L in formula 1 is an integer corresponding to the above-described shift amount in the data strings. The first term k and the last term r can be changed by the value of shift amount L, as indicated by formulae 2 to 5, for example.
When L.gtoreq.0: EQU k=k0+INT{-L/2} (2) EQU r=r0+INT{-L /2} (3)
When L&lt;0 EQU k=k0+INT{(-L+1)/2} (4) EQU r=r0+INT{(-L+1)/2} (5)
Here, k0 and r0 indicate the first and last terms when shift amount L=0.
FIG. 16 is a drawing showing the combination of arrays A and B on which difference determining algorithms have been conducted using formula 1, in the cases where the first term k and the last term r are changed by the above-described formulae 2 to 5. In this way, the ranges used in correlation algorithm for array A and array B are shifted in relatively opposite directions accompanying changes in shift amount L.
There is also a method wherein the first term k and the last term r are held constant regardless of the shift amount L, and in this case, the range used in correlation algorithms in one of the arrays is held constant, so that only the other array is shifted.
Because the relative position shift amount becomes shift amount L when a pair of data items match, the shift amount L is detected, which yields the correlation amount having the smallest value out of correlation amounts C[L] found using formula 1, and the defocus amount is the value obtained by multiplying this value by a constant determined from the optical system shown in FIG. 14 and the pitch width of the photoelectric conversion elements in the image sensor arrays. Hence, it is possible to detect large defocus amounts the larger the maximum shift number lmax is.
However, the correlation amounts C[L], which are computed using formula 1, are discrete values as shown in FIG. 15(c), and the smallest unit of the defocus amounts that can be detected is limited by the pitch width of the photoelectric conversion elements in the image sensor arrays A and B. A method wherein precision focus state detection is performed by conducting an interpolation algorithm on the basis of the discrete correlation amounts C[L] and in which a new truly smallest value Cex is calculated, is proposed in Japanese Laid-Open Patent Publication No. 60-37513, corresponding to U.S. Pat. No. 4,561,749. This is a method wherein the true smallest value Cex and the shift amount Ls are calculated from formulae 6 to 9 using correlation amount C[l], which is the smallest amount, and correlation amounts C[l+1] and C[l-1], which are the shift amounts to either side, as shown in FIG. 17. EQU DL=(C[l-1]-C[l+1])/2 (6) EQU Cex=C[l]-.vertline.DL.vertline. (7) EQU E=MAX {C[l+1]-C[l], C[l-1]-C[l]} (8) EQU Ls=l+DL/E (9)
In formula 8, MAX{Ca, Cb} means to select the larger of Ca and Cb. The defocus amount DF can be calculated from formula 10 using the shift amount Ls of above-described formula 9. EQU DF=Kf.times.Ls (10)
In formula 10, Kf is a constant found from the pitch width of the photoelectric conversion elements in the image sensor arrays and the focus state detecting optical system shown in FIG. 14.
Next, because it is necessary to determine whether the defocus amount obtained using formula 10 represents the true defocus amount or whether it is merely a fluctuation in the correlation amount caused by noise or the like, a determination is made that the computed defocus amount has a high level of confidence only when the conditions shown in formula 11 are satisfied. EQU E&gt;E1 and Cex/E&lt;G1 (11)
In formula 11, E1 and G1 are predetermined threshold values. In addition, the numerical value E shows the condition of the change in the correlation amount and is found from above-described formula 8. This numerical value E indicates the information amount contributed to the algorithms in formulae 6 to 9 and depends on the contrast in the subject. Consequently, the contrast is high and the level of confidence is high the larger the numerical value E is. Hereafter, numerical value E is called the information amount.
The value Cex of formula 11 indicates the difference when the pair of outputs from the image sensor arrays most nearly agree. The value Cex originally is 0. However, because of the effects of noise and because there is parallax between region 101 and region 102, a minute difference is created between the pair of subject images, so that in actuality this value does not become 0. Because the effects of noise and the difference in subject images are smaller the larger the contrast in the subject is, Cex/E is used as the numerical value indicating agreement between outputs from the pair of image sensor arrays. Naturally, the closer Cex/E is to 0, the higher the level of confidence and the greater the agreement between the outputs of the pair of image sensor arrays.
The determination of level of confidence can also be conducted by computing the contrast for one of the outputs from the pair of image sensor arrays in place of information amount E. When the determination is made that a high level of confidence exists, driving of shooting lens 100, or a display, is conducted on the basis of the defocus amount DF. Hereafter, the correlation algorithm, the interpolation algorithm and the condition determination of above-described formulae 1 to 11 together will be called the focus state detection algorithm.
Because in general the pair of data items is configured to agree when the shift amount L is essentially 0 with shooting lens 100 in an in-focus state, when shooting lens 100 has been focussed, it is impossible for shooting lens 100 to focus on the subject if the subject image is not composed within the range from the first term k0 to the last term r0 in the shift amount L=0 of image sensor arrays A and B. Accordingly, the area where focus state detection is conducted can be determined by the first term k0 and the last term r0. Hereafter, the data range between the first term k0 and the last term r0 when the shift amount L=0 will be called the algorithm range, and if the subject is in the region corresponding to the algorithm range on the photo field, this region becomes the focus state detection area because focus state detection is performed with respect to this subject. On the viewfinder screen, the focus state detection area is displayed as a focus state detection frame such as the solid line portion in the center of the photo field in FIG. 13, and it is possible for the photographer to effect focussing of the shooting lens on the desired subject by determining the composition so that the subject is inside this detection frame.
However, with this kind of focus state detection device, the shift amount of the pair of output signals differs depending on the position of the image sensor arrays when a plurality of subjects of varying distances are composed into images on the image sensor arrays. Consequently, a shift amount so that the pair of data items agrees does not exist, and the above-described value Cex becomes a large value. Accordingly, Cex/E does not satisfy the conditions of formula 11, and focus state detection may become impossible.
Hence, a method is disclosed in Japanese Patent Publication No. 60-262004 wherein the focus state detecting regions are subdivided by dividing the outputs of the pair of image sensor arrays each into a plurality of blocks, the defocus amount DF is calculated by conducting the focus state detection calculation on each of these blocks, and the block with a defocus amount indicating the closest distance or the block with the maximum numerical value E, for example, is selected out of this plurality of blocks. The defocus amount of this block is set as the focus state detection condition of the shooting lens, and driving of the shooting lens or a display is conducted in accordance with the above-described defocus amount.
Dividing into blocks is equivalent to forming a plurality of sets of initial terms k0 and last terms r0 in the shift amount L=0 in the correlation algorithm of above-described formula 1. For example, as shown in FIG. 23(a), in order to conduct the focus state detection algorithm by dividing the pair of image arrays each comprised of 46 data items into five blocks each composed of eight data items, the focus state detection algorithms from formulae 1 to 11 are conducted by setting k0=4 and r0=11 in block 1; and similarly, the settings k0=12 and r0=19, k0=20 and r0=27, k0=28 and r0=35, and k0=36 and r0=43, are set in blocks 2, 3, 4 and 5, respectively.
It is possible to create larger blocks in the same pair of image sensor arrays than in the case shown in FIG. 23(a), for example by dividing the arrays into three blocks each composed of 14 data items with block 1 being k0=3 to r0=16, block 2 being k0=17 to r0=30 and block 3 being k0=31 to r=44, as shown in FIG. 23(b).
However, when the boundary positions of the blocks are fixed at the time of block division, it becomes impossible to conduct focus state detection when the contrast of the subject is positioned at the boundary of a block, or there are cases where unstable algorithm results are obtained. Consequently, a method is disclosed in Japanese Laid-Open Patent Publication No. 2-135311, corresponding to U.S. Pat. No. 5,068,682, wherein the absolute value of the difference between adjacent data items near the boundary of the block is calculated, and the boundary is moved to a position where the absolute value of the difference is smallest.
In the above description, output signal strings a[1], . . . , a[n], b[1], . . . , b[n] of image sensor arrays A and B are used for focus state detection algorithms. However, when the image sensor array output contains high frequency components that are higher than the Nyquist frequency of the subject, focus state detection may not be conducted with precision when there is an unbalance in the outputs of array A and array B. Hence, a method is disclosed in Japanese Patent Publication No. 61-245123 wherein a filter algorithm process is enacted with respect to the output signal strings, and focus state detection algorithms are conducted using the filter process data.
For example, a filter algorithm process, which eliminates the high frequency components that are at least as high as the Nyquist frequency, is shown by formulae 12 and 13 hereafter, and with this it is possible to obtain from output signal strings a[1], . . . , a[n], b[1], . . . , b[n] of image sensor arrays A and B, high frequency omitted filter process data items Pa[1], . . . , Pa[n-2], Pb[1], . . . , Pb[n-2]. EQU Pa[i]=(a[i]+2.times.a[i+1]+a[i+2])/4 (12) EQU Pb[i]=(b[i]+2.times.b[i+1]+b[i+2])/4 (13)
where i=1 to n-2.
When a filter algorithm process is enacted that eliminates the effects of unbalance in the outputs of array A and array B, for example using formula 14, on filter process data items Pa[1], . . . , Pa[n-2], Pb[1], . . . , Pb[n-2], it is possible to obtain DC-eliminated filter process data items Fa[1], . . . , Fa[n-2-2s], Fb[1], . . . , Fb[n-2-2s]. EQU Fa[i]=-Pa[i]+2.times.Pa[i+s]-Pa[i+2s] (14) EQU Fb[i]=-Pb[i]+2.times.Pb[i+s]-Pb[i+2s] (15)
where i=1 to n-2-2s, s is an integer from 1 to 10, and the larger s is, the more the lower frequency components of the subject pattern are extracted, while the smaller s is, the more the high frequency components of the subject pattern are extracted.
In addition, the number of filter process data items diminishes the larger s is. Near the in-focus state, a relatively small value is desirable for s because the subject image contains a large number of high frequency components near the in-focus state, while in unfocussed states, large values are desirable for s because the subject image is blurry and contains only low frequency components. Because substantially all low frequency components are eliminated when s is small, detection is impossible when the defocus amount is large and there are no high frequency components. Accordingly, in this case there is no meaning in setting the maximum shift amount lmax very large in formula 1, so a relatively small value will do. Conversely, because detection is possible even with a large defocus amount when s is large because low frequency components are extracted, a relatively large value is set for lmax.
When s is relatively large, every other DC-eliminated filter process data item Fa[i] and Fb[i] obtained from formulae 14 and 15 can be removed, so that the number of data items is cut in half. By doing this, half the algorithm range will do in comparison with the uncut case despite having the same focus state detection area, because the width of two pixels is held in a single data item. In addition, because the shift amount in the cut case is double the shift amount in the uncut case, it is possible to detect a defocus amount of the same size even if the maximum shift number is cut in half.
FIGS. 18(a)-(c) are examples of a subject image having only low frequency components, with 18(a) being the output signal, 18(b) being the filter process data when s=2 and 18(c) being the filter process data when s=8. FIGS. 18(a)-(c) also show an in-focus state, that is to say, a state wherein the output signal string of array A and the output signal string of array B overlap. In this way, the s=2 filter process data items are flat, having substantially no contrast, while when s=8, the contrast is sufficient and a defocus amount with a high level of confidence is obtained.
In comparing the narrow algorithm range ce1 and the wide algorithm range ce2 in FIG. 18(c), the wide algorithm range ce2 can conduct more precise focus state detection because this range contains most of the contrast. That is to say, it is preferable to widen the algorithm range with filter process data items that extract low frequency components.
FIGS. 19(a)-c) illustrate the case where the subject image is composed only of high frequency components, with 19(a)-(c) being the same types of data as in FIGS. 18(a)-(c), and in an in-focus state. In this case, when s=2, contrast is sufficient, and a defocus amount with a high level of confidence can be obtained. In FIG. 19(b), comparing narrow algorithm range ce1 and wide algorithm range ce2 shows that the contrast contained in both is the same, but a narrower algorithm range will make it more difficult for effects of noise to be felt. That is to say, if the algorithm range is too wide, there will be cases wherein subjects of different distances will simultaneously be positioned within the algorithm range, and because focus state detection is impossible in this kind of situation, it is preferable to make the algorithm range relatively narrow with filter process data items that extract high frequency components.
FIGS. 20(a)-(c) illustrate a case where the subject has sufficient amounts of both high and low frequency components, with 19(a)-19(c) being the same types of data as in FIGS. 18(a)-(c) and in an in-focus state. With this pattern, sufficient contrast is obtained regardless of the value of s. In addition, the distribution range of the contrast of the pattern becomes larger as s becomes larger.
FIGS. 21(a)-(c) illustrate the case wherein the defocus amount is large, for example the output when viewing a subject such as a single chimney or the like. The data types in FIGS. 21(a)-(c) are the same as in FIGS. 18(a)-(c), and the solid line indicates the output signal string from array A while the dashed line indicates the output signal string from array B. In this way, when the defocus amount is large, contrast is not obtained with filter process data when s=2 because substantially no high frequency components are included. On the other hand, it is possible to obtain sufficient contrast with filter process data when s=8, so it is possible to determine the defocus amount with precision by setting the maximum shift number lmax to a sufficiently large value.
Because the frequency components contained in the subject vary, there is a method wherein s is first set to 2, filter process data, which extracts the high frequency components, is output, and the process is concluded if a defocus amount with a high level of confidence can be obtained by conducting the focus state detection algorithms of formulae 1 to 11 using this filter process data; while if a defocus amount with a high level of confidence cannot be obtained, s is set to 4, filter process data, which extracts low frequency components, is output and the focus state detection algorithms are conducted using formulae 1 to 11, and so forth with the value of s being increased and the filter process being switched until a defocus amount with a high level of confidence is obtained.
With this method, because the high frequency components are extracted initially, near an in-focus state of a normal subject, for example, in the case of the pattern including high frequency components shown in FIGS. 20(a)-(c), it is possible to obtain a defocus amount with a high level of confidence with the focus state detection algorithms using filter process data with s=2, and consequently, it is possible to conduct focus state detection with a short algorithm time. When the subject image is the face of a person or the like and has only low frequency components, for example in the case of the pattern shown in FIGS. 18(a)-(c), it is possible to obtain a defocus amount with a high level of confidence with focus state detection using filter process data that extracts low frequency components.
When the defocus amount is large such as in FIG. 21, it is preferable to compute the defocus amount by increasing the maximum shift number lmax using filter process data that extracts low frequency components and then conducting focus state detection algorithms. When this is done, it is possible to shorten the algorithm time near the in-focus state, it is possible to easily follow the subject when the subject is moving, and it is possible to focus even when the subject image includes only low frequency components, so that it becomes possible to detect even large defocus amounts.
The precision of defocus amounts obtained when the subject includes high frequency components is in general better than the precision of defocus amounts obtained when the subject includes only low frequency components, and consequently, by initially conducting focus state detection using filter process data that extracts high frequency components, it becomes possible to obtain defocus amounts with good precision.
With focus state detection conducted on blocks, a method is proposed in Japanese Laid-Open Patent Publication No. 6-82686, corresponding to U.S. Pat. No. 5,389,995, wherein s is initially set to 2, filter process data is output, which extracts high frequency components, focus state detection algorithms are conducted on each block using this filter process data, and the process is concluded if a block exists in which a defocus amount with a high level of confidence can be obtained; while when a defocus amount with a high level of confidence cannot be obtained, s is set to 4, filter process data is output, which extracts low frequency components, and focus state detection algorithms are conducted on each block using this filter process data, and so forth with the filter process being switched until a block exists in which a defocus amount with a high level of confidence can be obtained.
In above-described Japanese Laid-Open Patent Publication No. 2-135311, the absolute value of the difference of adjacent data items near the boundary of the block is computed, and the boundary position is moved so that the block boundary becomes the position where the absolute value of the difference is a minimum, but a process is proposed in Japanese Laid-Open Patent Publication No. 6-82686 wherein when filter process data that completely eliminates DC components is divided into a plurality of blocks, the absolute value of the difference between data near the block boundary and a predetermined value is computed, and the block boundary position is set on the basis of the absolute value of this difference.
The filter processes of formulae 14 and 15 are processes that completely eliminate the DC component, but when focus state detection algorithms are conducted using data from filter processes that completely eliminate the DC component, a problem arises that the possibility of a false focus is greater than when data is used in which the DC component remains. This problem will be described with reference to FIGS. 22(a)-(d)
FIGS. 22(a) and 22(b) are output signals from image sensor arrays A and B when a subject is viewed wherein the luminosity changes in steps moving from left to right across the focus state detection area. In these figures, the pattern in FIG. 22(a) and the pattern in FIG. 22(b) match by the portions indicated by the arrows overlapping, and consequently, it can be seen that the output of image sensor array A has been shifted to the left with respect to the output of array B. On the other hand, FIGS. 22(c) and 22(d) are the data patterns of FIGS. 22(a) and 22(b) where the data is from filter processes that completely eliminate the DC component. Because only the DC component differs between the data in FIGS. 22(a) and 22(b), the data is entirely the same when the DC component is completely eliminated. Hence, when focus state detection is conducted using these data, the determination is made that the subject is in focus because the pair of data items already relatively agree.
In this way, different patterns are changed in relatively similar directions by enacting filter processes that completely eliminate the DC component. This is particularly noticeable when the algorithm range is made narrower by conducting block division as described above.
Hence, a method is proposed in Japanese Laid-Open Patent Publication No. 6-82686 wherein filter algorithm processes (hereinafter called the DC reduction filter processes) are conducted that do not completely eliminate the DC component as shown in formulae 16 and 17, to obtain DC reduction filter process data Qa[i] and Qb[i]. EQU Qa[i]=-Pa[i]+4.times.Pa[i+y]-Pa[i+2y] (16) EQU Qb[i]=-Pb[i]+4.times.Pb[i+y]-Pb[i+2y] (17)
where i=1 to n-2-2y.
In focus state detection devices that conduct block division and then conduct focus state detection algorithms for each block, a method of determining a single defocus amount finally from the plurality of defocus amounts, other than the above-described methods of selecting the defocus amount indicating the closest distance or selecting the defocus amount of the block where the information value E is largest, are proposed in Japanese Patent Publication Nos. 2-178641 and 2-235512 (corresponding to U.S. Pat. No. 5,258,801). The method noted in the disclosures of these publications selects a block satisfying predetermined conditions as a standard block, sets the defocus amount of the standard block as a standard defocus amount, conducts a weighing coefficient determination on the basis of the amount of difference between the various defocus amounts and the standard defocus amount, and determines a weighted average of the plurality of defocus amounts using this weighing coefficient to compute a new defocus amount. The conditions for a standard block include the block that indicates a defocus amount indicating the closest distance. For example, when the amount of difference is small, the weighing coefficient is increased, and when the amount of difference is large, the weighing coefficient is made smaller.
With this method, when a plurality of subjects of differing distances are intermixed, it is possible to obtain a defocus amount relating to each of the subjects in the former manner; and when the subject is flat, such as a wall or the like, it is possible to obtain a stable defocus amount because the whole is averaged. When h is the number of blocks, Dfk is the standard defocus amount, Df[j] is the defocus amount and E[j] is the information amount E of block j, the combined defocus amount Dfm and combined information amount Em can be obtained using formulae 18 and 19 below. EQU Dfm=.SIGMA.(Df[j].times.E[j].times.W[j])/.SIGMA.(E[j].times.W[j]) (18) EQU Em=.SIGMA.(E[j].times.W[j]) (19)
where j=1 to h.
Weighing coefficient W[j] is determined as shown in FIG. 25 from the difference between Dfk and Df[j] and has a value between 0 and 1. ML and UL are predetermined values, so that W[j] is 1 when the absolute value of the difference in the defocus amounts is not greater than ML, is 0 when UL is exceeded, and changes in a linear manner between ML and UL. Thus, Df[j] is not used in the combining algorithm when W[j] is 0. The combined defocus amount Dfm obtained in this way is the final defocus amount. It is preferable for the value of ML to be a value between 30 .mu.m and 50 .mu.m, and for the value of UL to be between 80 .mu.m and 140 .mu.m.
On the other hand, when the subject pattern is a periodically repeating pattern, output signals from image sensor arrays A and B are obtained like those shown in FIGS. 24(a) and 24(b), and the correlation amount C[L] has a repeating pattern like that shown in FIG. 24(c), so that a plurality of correlation amounts of minimum value exist. Consequently, there is a strong possibility that the smallest value corresponding to the in-focus position will be erroneously selected, so that the determination will erroneously be an in-focus condition despite being a defocus condition, resulting in cases where a false focus is created.
Hence, in Japanese Laid-Open Patent Publication No. 2-238415, corresponding to U.S. Pat. No. 5,202,718, the fact that the subject has a periodic pattern is determined on the basis of the number of minimum values for the correlation amount C[L], and a warning is created. In addition, in Japanese Laid-Open Patent Publication No. 6-94987, corresponding to U.S. Pat. No. 5,389,995, the fact that the subject has a periodic pattern is determined on the basis of the correlation amount of the shift amounts separated by a predetermined shift number from the shift amount that yields the correlation amount of minimum value, and on the basis of the correlation amount of the shift amounts near the shift amount separated by a predetermined shift number. Blocks in which the subject is determined to be periodic are considered to be blocks where focus state detection is impossible even if a defocus amount with a high level of confidence can be obtained.
A first problem that arises in this kind of focus state detection device will now be described. FIG. 29 shows one of the pair of output signal strings when a subject that includes high frequency components is intermixed in the background of a subject composed of low frequency components, such as a human face or the like, and in this figure, Ob1 is a human face and Ob2 is the background. In focus state detection that conducts block division as described above in this kind of case, filter process data is first output that extracts the high frequency components, focus state detection algorithms are conducted on each block using this filter process data, and the process is concluded if a block exists wherein a defocus amount with a high level of confidence can be obtained; and when a defocus amount with a high level of confidence cannot be obtained, filter process data is output that extracts low frequency components, focus state detection algorithms are conducted on each block using this filter process data, and so forth with the filter process being switched until a block exists where a defocus amount with a high level of confidence can be obtained. Because the human face is composed only of low frequency components, a defocus amount with a high level of confidence cannot be obtained in blocks corresponding to subject Ob1 in the first focus state detection algorithms using filter process data that extracts high frequency components. However, because the background contains high frequency components, a defocus amount with a high level of confidence can be obtained in blocks corresponding to subject Ob2. Accordingly, the algorithm process is concluded, and because only a defocus amount relating to the background is obtained, shooting lens 100 focusses on the background and not on the person.
A second problem occurs in the case where the subject is completely periodic, and in Japanese Laid-Open Patent Publication No. 6-94987, focus state detection is impossible in blocks where the subject is determined to be periodic, even if a defocus amount with a high level of confidence can be obtained. When this occurs, focus state detection is impossible with respect to a subject that is completely periodic, such as a building or the like where windows are lined up with a definite period.
A third problem is the combining process and the setting of the weighing coefficient on the basis of a standard block. When the information amount of the block that is the standard is not very numerous, the standard defocus amount itself is dispersed, and consequently, the weighing coefficient for each block becomes unstable, making it impossible to obtain a stable final defocus amount.
A fourth problem is a problem that occurs when data is used in which the DC component is not completely eliminated, such as DC reduction filter process data, and this problem will be described with reference to FIGS. 26(a)-(b). FIG. 26(a) is the DC reduction filter process data when the subject has a brightness that changes dramatically, and because of the in-focus condition, Qa[i] and Qb[i] overlap. In this state, a slight deficiency in balance is created in output signals a[i] and b[i] of image sensor 2, so that the data becomes like the DC reduction filter process data of FIG. 26(b). In this figure, the dashed line is Qb[i] and the solid line is Qa[i]. Accordingly, Qa[i] is data that has shifted to the right with respect to Qb[i], and because this shifted amount is computed in obtaining a defocus amount in the focus state detection algorithms, a defocus amount is computed that shows that this state is not an in-focus state. Even when the brightness changes dramatically such as in FIG. 27, if the data takes the shape of a mountain with a peak in the brightness distribution, even if the balance is off, little effect will be felt by taking the boundary to be the position of the peak in brightness, so that Qa[i] and Qb[i] are shifted in opposite directions and relatively cancel each other. However, when block division is conducted, there are cases where a problem arises in the pattern within the range of some out of the plurality of blocks, even when no problem arises for the sensor as a whole. For example, the brightness changes dramatically within the range of block 4 in FIG. 28, and because this is not a mountain-shaped pattern, the defocus amount computed for block 4 will have low precision, so there is a possibility that the final defocus amount will be unstable.